import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/home',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/',
      name: 'Login',
      component: () => import('../views/Login.vue')
    },
    {
      path: '/login',
      redirect: '/'
    },
    {
      path: '/network-test',
      name: 'NetworkTest',
      component: () => import('../views/NetworkTest.vue')
    },
    {
      path: '/Main',
      name: 'Main',
      component: () => import('../views/Main.vue'),
      children: [
        {
          path: '/ProductionInfo',
          name: 'ProductionInfo',
          component: () => import('../views/Trace Mgmt/ProductionInfo.vue')
        }, 
          {
          path: '/TBDetails',
          name: 'TBDetails',
          component: () => import('../views/Trace Mgmt/TBDetails.vue')
        }, 
        {
          path: '/Breeding',
          name: 'Breeding',
          component: () => import('../components/Traceability/Breeding.vue')
        },
        {
          path: '/Slaughter',
          name: 'Slaughter',
          component: () => import('../components/Traceability/Slaughter.vue')
        }
      ]
    }
  ]
})

export default router